<!DOCTYPE html>
<html>
<#include "include/header.html"/>
<body>
<div class="page">
	<div class="content">
		<div class="overview">
			<div class="top1">
				<span class="btn_del" onClick="emptyRecord()">清空</span>
				最多保存20条浏览记录
			</div>
			<div id="divInfo">
			<#list recordList as a>
			<div class="item" id="${a.id!}">
				<a href="javascript:void(0);" onclick="commodityDetail('${a.commodity_id}','${a.commodity_type}');return false"><img src="${server_uri!}${a.commodity_logo!}" class="pic"></a>
				<div class="title">${a.commodity_name!}</div>
				<div class="price">${a.commodity_price!}</div>
				<div class="del" onClick="deleteRecord('${a.id!}')"><span>删除</span></div>
				<div class="clear"></div>
			</div>
			</#list>
			</div>
		</div>
	</div>
</div>
<script>
$(function(){

	$(".overview .item").swipe({
		swipe:function(event, direction, distance, duration, fingerCount) {
			if(direction == "left"){
				$(this).addClass("on")
			}else if(direction == "right"){
				$(this).removeClass("on")
			}
		}
	})
	commodityDetail=function(commodity_id,commodity_type){
		 if(commodity_type == "01"){
			 window.location.href="${ctx}/home/commodityDetail?id="+commodity_id;
		 }
	 }
	 deleteRecord=function(id){
		$.ajax({
			type:"POST",
			url:"${ctx}/mine/deleteRecord?record_id="+id,
			success : function(json){
				if(json.code==0){
					$("#"+id).remove();
				}else{
				dialog('#ok',3000,json.msg);
				}
				   
			}
		});
	}
	emptyRecord=function(){
		$("#divInfo").html("");
		$.ajax({
			type:"POST",
			url:"${ctx}/mine/emptyRecord",
			success : function(json){
				if(json.code==0){
					$("#divInfo").html("");
				}else{
				dialog('#ok',3000,json.msg);
				}
			}
			
		});
	}
})
</script>
</body>
</html>